import { getDB } from '../../db';
/**
 * 查询用户信息
 */
export const createQueryUserInfoStatement = () => {
  const db = getDB();
  return db.prepare<[{ name: string; password: string }]>(`
      select * FROM "main"."user_info"
      WHERE "name"=@name and "password"=@password
    `);
};

//TODO - 待删除
// 视频录制与编辑 视频剪辑的标注
export const createAddMarkInfoStatement = () => {
  const db = getDB();
  return db.prepare<[LX.DBService.MarkInfoInfo]>(`
      INSERT INTO "main"."video_mark_info" ("id","video_info_id","start_time","end_time","label","describe","channel","status","create_time","create_user")
      values(@id,@videoInfoId,@startTime,@endTime,@label,@describe,@channel,@status,@createTime,@createUser)`);
};

//TODO - 待删除
// 实时监控的标注     todo
export const createRealTimeMonitoring = () => {
  const db = getDB();
  return db.prepare<[LX.DBService.MarkRealTimeInfoInfo]>(`
      INSERT INTO "main"."video_real_mark_info" ("id","start_time","end_time","label","describe","channel","status","create_time","create_user")
      values(@id,@startTime,@endTime,@label,@describe,@channel,@status,@createTime,@createUser)`);
};

/**
 * 修改密码
 */
export const createEditUserInfoStatement = () => {
  const db = getDB();
  return db.prepare<[LX.DBService.EditUserInfo]>(
    `update "main"."user_info" set "password" = @password where "id" = @id`,
  );
};
